package com.tianxiabuyi.weixin.pay.base;


/**
 * 商户信息
 *
 * Created by exizhai on 11/22/2015.
 */
public class PaySetting {


    /**
     * 商户ID
     */
    private String mchId;

    /**
     * 商户的appId
     */
    private String appId;

    /**
     * 秘钥
     */
    private String key;

    /**
     * 证书位置
     */
    private String certPath;

    /**
     * 证书密码
     */
    private String certPassword;

    public String getMchId() {
        return mchId;
    }

    public void setMchId(String mchId) {
        this.mchId = mchId;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getCertPath() {
        return certPath;
    }

    public void setCertPath(String certPath) {
        this.certPath = certPath;
    }

    public String getCertPassword() {
        return certPassword;
    }

    public void setCertPassword(String certPassword) {
        this.certPassword = certPassword;
    }

    /**
     * 支付基本信息设置
     * @param mchId
     * @param appId
     * @param key
     * @param certPath
     * @param certPassword
     */
    public PaySetting(String mchId, String appId, String key, String certPath, String certPassword) {
        this.mchId = mchId;
        this.appId = appId;
        this.key = key;
        this.certPath = certPath;
        this.certPassword = certPassword;
    }

    /**
     * 支付基本信息设置，此时certPassword默认为商户id（mchId）
     * @param mchId
     * @param appId
     * @param key
     * @param certPath
     */
    public PaySetting(String mchId, String appId, String key, String certPath) {
        this.mchId = mchId;
        this.appId = appId;
        this.key = key;
        this.certPath = certPath;
        this.certPassword = mchId;
    }
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        PaySetting that = (PaySetting) o;

        if (!mchId.equals(that.mchId)) return false;
        return !(appId != null ? !appId.equals(that.appId) : that.appId != null);

    }

    @Override
    public int hashCode() {
        int result = mchId.hashCode();
        result = 31 * result + (appId != null ? appId.hashCode() : 0);
        return result;
    }
}
